<template>
  <div class="hi">
    <h1>{{ msg }}</h1>
    <h3>hehehehda</h3>
  </div>
</template>

<script>
  export default {
    name: 'Hi1',
    data () {
      return {
        msg: 'Hi1 ! I am Hi1 !'
      }
    },
    beforeRouteEnter: function (to, from, next) {
      console.log('准备进入H1模板')
      console.log(from)
      next()
      // next()函数控制路由跳转,不写的话则不会跳转. 接受参数可以是布尔值.也可以是对象
      // next(true);
      // next({path: '/'}), 该对象会覆盖原先设置的跳转路由
    },
    beforeRouteLeave: function (to, from, next) {
      console.log('准备离开H1模板')
      console.log(from)
      next()
      // next()函数控制路由跳转,不写的话则不会跳转. 接受参数可以是布尔值.也可以是对象
      // next(true);
      // next({path: '/'}), 该对象会覆盖原先设置的跳转路由
    }
  }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>

</style>
